#pragma once

// definitions for the specialized buttons used in the SpaceShooter game

#include "MenuButton.h"
#include <cstdio>
#include <string.h>

class SpaceShooterClient;

////////////////////////////////////////////////
// Button_EnergyReserves
//
// Update: gets the current energy reserves
// Render: renders the energy value
// Mouseover: Nothing
// Click: Nothing
// Activates on: Nothing
// Deactivates on: Nothing
// Darkens on: Nothing
// Highlights on: Nothing
///////////////////////////////////////////////
class Button_EnergyReserves : public MenuButton
{
public:
	Button_EnergyReserves(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_EnergyReserves(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_BlasterEnergy
//
// Update: Gets the current blaster energy value
// Render: Renders the energy value
// Mouseover: Nothing
// Click: Nothing
// Deactivates on: Nothing
// Activates on: Nothing
// Darkens on: Nothing
// Highlights on: Nothing
///////////////////////////////////////////////
class Button_BlasterEnergy : public MenuButton
{
public:
	Button_BlasterEnergy(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_BlasterEnergy(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_ShieldEnergy
//
// Update: Gets the current shield energy value
// Render: renders the energy value, or number of turns remaining if damaged
// Mouseover: Nothing
// Click: Nothing
// Activate: Nothing
// Deactivate: Nothing
// Darkens on: Damaged shields
// Highlights on: Repaired shields
///////////////////////////////////////////////
class Button_ShieldEnergy : public MenuButton
{
public:
	Button_ShieldEnergy(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_ShieldEnergy(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_IncreaseBlasters
//
// Update: Nothing
// Render: Renders a "+"
// Mouseover: Highlights button
// Click: Sends message to client to increase blasters (which sends message to server)
// Activates on: Repaired blasters
// Deactivates on: Damaged blasters
// Darkens on: no mouseover
// Highlights on: mouseover
///////////////////////////////////////////////
class Button_IncreaseBlasters : public MenuButton
{
public:
	Button_IncreaseBlasters(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_IncreaseBlasters(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_DecreaseBlasters
//
// Update: Nothing
// Render: Renders a "-"
// Mouseover: Highlights button
// Click: Sends message to client to decrease blasters (which sends message to server)
// Activates on: Repaired blasters
// Deactivates on: Damaged blasters
// Darkens on: No mouseover
// Highlights on: Mouseover
///////////////////////////////////////////////
class Button_DecreaseBlasters : public MenuButton
{
public:
	Button_DecreaseBlasters(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_DecreaseBlasters(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_IncreaseShields
//
// Update: Nothing
// Render: Renders a "+"
// Mouseover: Highlights button
// Click: Sends message to client to increase shields (which sends message to server)
// Activates on: Repaired shields
// Deactivates on: Damaged shields
// Darkens on: no mouseover
// Highlights on: mouseover
///////////////////////////////////////////////
class Button_IncreaseShields : public MenuButton
{
public:
	Button_IncreaseShields(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_IncreaseShields(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_DecreaseShields
//
// Update: Nothing
// Render: Renders a "-"
// Mouseover: Highlights button
// Click: Sends message to client to decrease shields (which sends message to server)
// Activates on: Repaired shields
// Deactivates on: Damaged shields
// Darkens on: No mouseover
// Highlights on: Mouseover
///////////////////////////////////////////////
class Button_DecreaseShields : public MenuButton
{
public:
	Button_DecreaseShields(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_DecreaseShields(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_MissilesRemaining
//
// Update: gets the # of remaining missiles
// Render: renders the # of missiles, or number of turns remaining if damaged
// Mouseover: Nothing
// Click: Nothing
// Activates on: Nothing
// Deactivates on: Nothing
// Darkens on: Repaired missiles
// Highlights on: Damaged missiles
///////////////////////////////////////////////
class Button_MissilesRemaining : public MenuButton
{
public:
	Button_MissilesRemaining(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_MissilesRemaining(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_TurnsRemaining
//
// Update: gets the # of remaining turns
// Render: renders the # of turns
// Mouseover: Nothing
// Click: Nothing
// Activates on: Nothing
// Deactivates on: Nothing
// Darkens on: Nothing
// Highlights on: Nothing
///////////////////////////////////////////////
class Button_TurnsRemaining : public MenuButton
{
public:
	Button_TurnsRemaining(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_TurnsRemaining(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};


////////////////////////////////////////////////
// Button_Docked
//
// Update: Nothing
// Render: Renders text notifying the player that they are docked, and they should click to undock
// Mouseover: Highlights button (if active)
// Click: Sends message to client to undock (if active)
// Activates on: Docked
// Deactivates on: Undocked
// Darkens on: No mouseover
// Highlights on: Mouseover
///////////////////////////////////////////////
class Button_Docked : public MenuButton
{
public:
	Button_Docked(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_Docked(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};


////////////////////////////////////////////////
// Button_RestartGame
//
// Update: Nothing
// Render: Renders text to restart game
// Mouseover: Highlights button
// Click: Sends message to client to restart game
// Activates on: Nothing
// Deactivates on: Nothing
// Darkens on: No mouseover
// Highlights on: Mouseover
///////////////////////////////////////////////
class Button_RestartGame : public MenuButton
{
public:
	Button_RestartGame(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_RestartGame(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_WaitOneTurn
//
// Update: Checks if any subsystems are damaged and updates its state
// Render: Renders text to wait one turn
// Mouseover: Highlights button (if active)
// Click: Sends message to client to wait one turn
// Activates on: any Subsystem damaged
// Deactivates on: all subsystems repaired
// Darkens on: No mouseover
// Highlights on: Mouseover
///////////////////////////////////////////////
class Button_WaitOneTurn : public MenuButton
{
public:
	Button_WaitOneTurn(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_WaitOneTurn(void);

	virtual bool Update(POINT mousepos, bool buttonDown);

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_GalaxyMap
//
// Update: Checks if hyperdrive is damaged and current state of game map
// Render: Renders text to Hyperdrive
// Mouseover: Highlights button (if active)
// Click: Sends message to client to wait one turn
// Activates on: Hyperdrive repaired
// Deactivates on: Hyperdrive damaged
// Darkens on: No mouseover
// Highlights on: Mouseover
///////////////////////////////////////////////
class Button_GalaxyMap : public MenuButton
{
public:
	Button_GalaxyMap(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_GalaxyMap(void);

	virtual bool Update(POINT mousepos, bool buttonDown); // buttons return true/false based on whether they accepted user input

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_SublightDamaged
//
// Update: Checks if sublight is damaged
// Render: Renders text to warn player that the sublight is damaged
// Mouseover: Nothing
// Click: Nothing
// Activates on: Sublight damaged
// Deactivates on: Sublight repaired
// Darkens on: Nothing
// Highlights on: Nothing
///////////////////////////////////////////////
class Button_SublightDamaged : public MenuButton
{
public:
	Button_SublightDamaged(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_SublightDamaged(void);

	virtual bool Update(POINT mousepos, bool buttonDown); // buttons return true/false based on whether they accepted user input

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_LRSDamaged
//
// Update: Checks if LRS is damaged
// Render: Renders text to warn player that the LRS is damaged
// Mouseover: Nothing
// Click: Nothing
// Activates on: LRS damaged
// Deactivates on: LRS repaired
// Darkens on: Nothing
// Highlights on: Nothing
///////////////////////////////////////////////
class Button_LRSDamaged : public MenuButton
{
public:
	Button_LRSDamaged(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_LRSDamaged(void);

	virtual bool Update(POINT mousepos, bool buttonDown); // buttons return true/false based on whether they accepted user input

private:
	SpaceShooterClient* mGame;
};

////////////////////////////////////////////////
// Button_FireBlasters
//
// Update: Nothing
// Render: Renders "Fire Blasters"
// Mouseover: Highlights button
// Click: Sends message to client to fire blasters (which sends message to server)
// Activates on: Repaired blasters
// Deactivates on: Damaged blasters
// Darkens on: no mouseover
// Highlights on: mouseover
///////////////////////////////////////////////
class Button_FireBlasters : public MenuButton
{
public:
	Button_FireBlasters(SpaceShooterClient* game, ButtonType id, float xLeft, float xRight, float yTop, float yBottom, int w, int h, LPCSTR texLit, LPCSTR texUnlit, ID3DXSprite* sprite, ID3DXFont* font);

	virtual ~Button_FireBlasters(void);

	virtual bool Update(POINT mousepos, bool buttonDown); // buttons return true/false based on whether they accepted user input

private:
	SpaceShooterClient* mGame;
};